﻿using System;

namespace UtilZ.Dotnet.Ex.Base
{
    /// <summary>
    /// 时间戳工厂接口
    /// </summary>
    public interface ITimestampFactory
    {

        #region 属性
        /// <summary>
        /// 获取参照基准时间
        /// </summary>
        DateTime RefTime { get; }

        /// <summary>
        /// 获取时间戳单位
        /// </summary>
        TimestampUnit TimestampUnit { get; }

        /// <summary>
        /// 获取时间戳精度
        /// </summary>
        uint Precision { get; }

        /// <summary>
        /// 获取参照基准时间对应的时间戳值,即当前支持的最小时间戳
        /// </summary>
        double MinTimestamp { get; }

        /// <summary>
        /// 获取参考时间最大值对应的时间戳值,即当前支持的最大时间戳
        /// </summary>
        double MaxTimestamp { get; }
        #endregion







        #region Timestamp

        /// <summary>
        /// 获取当前日期时间的时间戳
        /// </summary>
        /// <returns>当前时间的时间戳</returns>
        long GetTimestamp();

        /// <summary>
        /// 获取指定日期时间的时间戳
        /// </summary>
        /// <param name="dateTime">计算时间戳时间</param>
        /// <returns>当前时间的时间戳</returns>
        long GetTimestamp(DateTime dateTime);

        /// <summary>
        /// 时间戳转换为DateTime
        /// </summary>
        /// <param name="timestamp">时间戳</param>
        /// <returns>时间</returns>
        DateTime TimestampToDateTime(long timestamp);

        /// <summary>
        /// 时间戳转换为DateTime
        /// </summary>
        /// <param name="timestamp">时间戳</param>
        /// <returns>时间</returns>
        DateTime TimestampToDateTime(double timestamp);
        #endregion


        /*
        #region TicksTimestamp
        
        /// <summary>
        /// 获取指定时间的Ticks时间戳
        /// </summary>
        /// <param name="dateTime">时间</param>
        /// <param name="timestampUnit">Ticks时间戳单位</param>
        /// <param name="precision">时间戳精度</param>
        /// <returns>Ticks时间戳</returns>
        double GetTicksTimestampD(DateTime dateTime, TimestampUnit timestampUnit = TimestampUnit.Millisecond, uint precision = 1);

        /// <summary>
        /// 获取指定时间的Ticks时间戳
        /// </summary>
        /// <param name="timestampUnit">Ticks时间戳单位</param>
        /// <param name="precision">时间戳精度</param>
        /// <returns>Ticks时间戳</returns>
        double GetTicksTimestampD(TimestampUnit timestampUnit = TimestampUnit.Millisecond, uint precision = 1);

        /// <summary>
        /// Ticks时间戳转换为DateTime
        /// </summary>
        /// <param name="timestamp">Ticks时间戳</param>
        /// <param name="timestampUnit">Ticks时间戳单位</param>
        /// <param name="dateTimeKind">时间类型,默认类型为本地时间</param>
        /// <param name="precision">时间戳精度</param>
        /// <returns>DateTime</returns>
        DateTime TicksTimestampToDateTime(double timestamp, TimestampUnit timestampUnit, DateTimeKind dateTimeKind, uint precision);
      
        #endregion

        */
    }
}
